﻿using System;
using System.Net;
using System.ComponentModel;
using System.Collections.Generic;
using caedisi.Web.DataModel;
using System.Collections.ObjectModel;
using System.ServiceModel.DomainServices.Client;
using caedisi.Common;
using System.Linq;
using caedisi.Helpers;

namespace caedisi.Models
{
    public class InvertedCellItem : INotifyPropertyChanged
    {
        /// <summary>
        /// Gets or sets the cell id.
        /// </summary>
        /// <value>
        /// The cell id.
        /// </value>
        public Guid CellId { get; private set; }


        /// <summary>
        /// Gets or sets the cell state type id.
        /// </summary>
        /// <value>
        /// The cell state type id.
        /// </value>
        public int CellStateTypeId
        {
            get;
            set;
        }

        /// <summary>
        /// Gets the type of the cell state.
        /// </summary>
        /// <value>
        /// The type of the cell state.
        /// </value>
        public CellStateType CellStateType
        {
            get 
            {
                return EntityHelper.GetCellStateType(CellStateTypeId);
            }
        }

        /// <summary>
        /// Gets or sets the immunity value. It is only meaningful when the cell is decontaminated, it is null otherwise
        /// </summary>
        /// <value>
        /// The immunity value.
        /// </value>
        public int? ImmunityTimerValue { get; set; }


        /// <summary>
        /// Initializes a new instance of the <see cref="InvertedCellItem"/> class.
        /// </summary>
        /// <param name="cellId">The cell id.</param>
        /// <param name="cellStateTypeId">The cell state type id.</param>
        public InvertedCellItem(Guid cellId, int cellStateTypeId)
        {
            CellId = cellId;
            CellStateTypeId = cellStateTypeId;
        }
            

        /// <summary>
        /// Resets this instance.
        /// </summary>
        public void Reset()
        {
        }

        #region INotifyPropertyChanged

        public event PropertyChangedEventHandler PropertyChanged;
        /// <summary>
        /// Raises the property changed.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        protected virtual void RaisePropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = this.PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
       
}
